/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package model;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author elfatah
 */
@Entity
@Table(name = "bagian")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Bagian.findAll", query = "SELECT b FROM Bagian b"),
    @NamedQuery(name = "Bagian.findByBagianId", query = "SELECT b FROM Bagian b WHERE b.bagianId = :bagianId"),
    @NamedQuery(name = "Bagian.findByNama", query = "SELECT b FROM Bagian b WHERE b.nama = :nama")})
public class Bagian implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "BAGIAN_ID")
    private Integer bagianId;
    @Column(name = "NAMA")
    private String nama;

    public Bagian() {
    }

    public Bagian(Integer bagianId) {
        this.bagianId = bagianId;
    }

    public Integer getBagianId() {
        return bagianId;
    }

    public void setBagianId(Integer bagianId) {
        this.bagianId = bagianId;
    }

    public String getNama() {
        return nama;
    }

    public void setNama(String nama) {
        this.nama = nama;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (bagianId != null ? bagianId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Bagian)) {
            return false;
        }
        Bagian other = (Bagian) object;
        if ((this.bagianId == null && other.bagianId != null) || (this.bagianId != null && !this.bagianId.equals(other.bagianId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.Bagian[ bagianId=" + bagianId + " ]";
    }
    
}
